package com.dragons.dragonsvf.controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;

/** 需要登录后携带JWT才能访问 */
@RestController
public class SecureCtrl {

    private static final Logger logger = LoggerFactory.getLogger(SecureCtrl.class);

    /** 查询 用户信息，登录后携带JWT才能访问 */
    @RequestMapping("/secure/getUserInfo")
    public String login(HttpServletRequest request) {
        Integer id = (Integer) request.getAttribute("id");
        String userName = request.getAttribute("userName").toString();
        String password= request.getAttribute("password").toString();
        return "当前用户信息id=" + id + ",userName=" + userName+ ",password=" + password;
    }

    /**
     http://localhost:8888/login?userName=zhangsan&password=123456，登录成功后接口返回token

     http://localhost:8080/secure/getUserInfo
     */

}
